package fibTests;

public class FibRecNaive implements IFib {
	private int iterations;
	
	public FibRecNaive() {
		iterations = 0;
	}
	
	@Override
	public int getLastIterationsCounter() {
		return iterations;
	}

	@Override
	public long fib(int n) {
		if (n <= 0) return 0;
		iterations = 1;
		if (n <= 2) return 1;
		return fibInner(n-1)+fibInner(n-2);
	}
	
	private long fibInner(int n) {
		iterations++;
		if (n <= 2) return 1;
		return fibInner(n-1)+fibInner(n-2);
	}

}
